<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>房源信息列表</h3></div>
                <div class="fr">
                    <form class="search-form" method="post" action="">
                        <span>查询条件:</span>
                        <select name="field">
                            <option value="community_id" <if condition="$filter.field eq 'community_id'">selected="selected"</if>>小区名称</option>
                            <option value="name" <if condition="$filter.field eq 'name'">selected="selected"</if>>房源编号</option>
                            <option value="zhname" <if condition="$filter.field eq 'zhname'">selected="selected"</if>>住户姓名</option>
                            <option value="zhidno" <if condition="$filter.field eq 'zhidno'">selected="selected"</if>>住户身份证</option>
                            <option value="addr" <if condition="$filter.field eq 'addr'">selected="selected"</if>>房源地址</option>
                            <option value="state" <if condition="$filter.field eq 'state'">selected="selected"</if>>房源状态</option>
                        </select>
                        <input name="value" value="{$filter.value}" type="text" placeholder="输入关键字按回车" />
                        <input name="page" value="{$filter.page}" type="hidden" />
                        <input name="order_field" value="{$filter.order_field}" type="hidden" />
                        <input name="order_sort" value="{$filter.order_sort}" type="hidden" />
                        <input name="where" value='{$filter.where}' type="hidden" />
                        <button name="submit-search" class="btn-normal" type="submit">查 询</button>
                    </form>
                </div>
            </div>
            <div class="line2">
                <div class="fl form-btn-group">
                    <in name="$x|default='02-03-06'" value="$rightsCode">
                        <button onclick="location.href='/admin/house/add'" class="btn-create btn-highlight">新 建</button>
                        <else />
                        <button disabled="disabled" class="btn-save btn-disable">新 建</button>
                    </in>
                    <in name="$x|default='02-03-08'" value="$rightsCode">
                        <span> 或 </span>
                        <a href="/admin/house/import" class="linkBtn btn-abort">导入</a>
                    </in>
                </div>
                <div class="fl form-btn-more">
                    <button class="btn-normal btn-more">更多操作<i class="drop-down"></i></button>
                    <ul class="more-action hidden">
                        <in name="$x|default='02-03-07'" value="$rightsCode">
                            <li><a onclick="action_del();" href="javascript:void(0);">删 除</a></li>
                        </in>
                        <in name="$x|default='02-03-09'" value="$rightsCode">
                            <li><a onclick="action_export('house');" href="javascript:void(0)">导出房源信息</a></li>
                        </in>
                        <in name="$x|default='02-03-10'" value="$rightsCode">
                            <li><a onclick="showDialog('exportShenjiDlg');" href="javascript:void(0)">导出审计信息</a></li>
                        </in>
                    </ul>
                </div>
                <div class="fr form-search-count">
                    <span class="offset">({$page.from}-{$page.to})</span>
                    <span class="total">共{$page.total}条</span>
                    <button onclick="PageJump({$page.prevPage});" class="btn-normal">上一页</button>
                    <button onclick="PageJump({$page.nextPage});" class="btn-normal">下一页</button>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box">
        <table class="list">
            <thead>
                <tr>
                    <th width="5%"><input id="select-all" type="checkbox" /></th>
                    <th width="14%" class="list-header" field="name" sort="{$filter.order_sort}">
                        房源编号<if condition="$filter.order_field eq 'name'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="25%" class="list-header" field="addr" sort="{$filter.order_sort}">
                        房源地址<if condition="$filter.order_field eq 'addr'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="12%" field="community_id" sort="{$filter.order_sort}">
                        小区名称<if condition="$filter.order_field eq 'community_id'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="10%" field="size" sort="{$filter.order_sort}">
                        房屋面积<if condition="$filter.order_field eq 'size'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="12%" field="price" sort="{$filter.order_sort}">
                        月租金<if condition="$filter.order_field eq 'price'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th width="12%" field="zhname" sort="{$filter.order_sort}">
                        住户姓名<if condition="$filter.order_field eq 'zhname'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                    <th field="state" sort="{$filter.order_sort}">
                        房源状态<if condition="$filter.order_field eq 'state'"><i class="icon-{$filter.order_sort}"></i></if>
                    </th>
                </tr>
            </thead>
            <tbody>
                <volist name="list" id="vo" key="index">
                    <tr class="house-info" offset="{$vo.offset}" data-id="{$vo.id}">
                        <td class="checkbox-cell"><input  class="checkbox" data-id="{$vo.id}" type="checkbox" /></td>
                        <td>{$vo.name}</td>
                        <td>{$vo.addr}</td>
                        <td>{$community[$vo[community_id]]}</td>
                        <td>{$vo.size}</td>
                        <td>{$vo.price}</td>
                        <td>{$vo.zhname}</td>
                        <td>{$vo.state}</td>
                    </tr>
                </volist>
            </tbody>
        </table>
    </div>
</div>
<div class="dialog-reqnianshen dialog hidden">
    <div class="box">
        <div class="title">
            <h4 class="fl">年审设置单对话框</h4>
            <span class="fr"><a href="#" onclick="closeDialog();">关闭</a></span>
        </div>
        <table class="form-tab" style="margin-top:50px;">
            <tr>
                <th width="120">是否需要年审：</th>
                <td>
                    <input name="req_nianshen" class="pse-radio" type="checkbox" checked="checked" value="是" /><label>是</label>
                    <input name="req_nianshen" class="pse-radio" type="checkbox" value="否" /><label>否</label>
                    <label style="margin-left:10px;color:red;">*必填项</label>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center;line-height:80px;">
                    <button class="btn btn-highlight" onclick="action_setNS();">提交</button>
                    <span>或</span>
                    <a href="#" onclick="closeDialog();" class="linkBtn">放弃</a>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="dialog exportShenjiDlg hidden">
    <div class="box" style="height: 240px;">
        <div class="title">
            <h4 class="fl">导出审计信息对话框</h4>
            <span class="fr"><a href="#" onclick="closeDialog();">关闭</a></span>
        </div>
        <table class="form-tab">
            <tr>
                <th width="80">开始年份：</th>
                <td>
                    <select name="year1" style="width:100px;">
                        <volist name="years" id="vo">
                            <option>{$vo}年</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <th>结束年份：</th>
                <td>
                    <select name="year2" style="width:100px;">
                        <volist name="years2" id="vo">
                            <option>{$vo}年</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center;line-height:40px;">
                    <button class="btn btn-highlight" onclick="action_export('shenji');">提交</button>
                    <span>或</span>
                    <a href="#" onclick="closeDialog();" class="linkBtn">放弃</a>
                </td>
            </tr>
        </table>
    </div>
</div>
<script>
    function action_setNS(){
        var state = fn_GetRadioValue('req_nianshen');
        var dataIds = new Array();
        $(".checkbox").each(function(){ //由于复选框一般选中的是多个,所以可以循环输出
            if($(this).is(":checked")){
                dataIds.push( parseInt($(this).attr("data-id")));
            }
        });
        if(dataIds.length==0){
            alert("请选择至少一条房源信息");
            return false;
        }
        $.ajax({
            url:"/admin/house/ajax_UpdateNS",
            data: {info:dataIds, state:state}, type:"POST", dataType:"JSON",
            success: function(data){
                if(data.status){
                    alert("操作成功");
                    location.reload();
                }else{
                    alert(data.info);
                }
            }
        });
    }
</script>
<script src="__JS__/house.js?v=0.1" type="text/javascript" ></script>
<include file="Public:footer" />

